package com.ystarkotlin.application

import android.app.Application
import android.content.Context
import androidx.multidex.MultiDex
import com.ystarkotlin.utils.DelegatesExt
import dagger.android.AndroidInjector
import dagger.android.support.DaggerApplication

import me.jessyan.autosize.AutoSizeConfig
import me.jessyan.autosize.unit.Subunits



/**
 * Created by Ystar
 *Data 2019/8/28
 */
open class YApplication : DaggerApplication() {

    override fun applicationInjector(): AndroidInjector<out DaggerApplication>? {
        return null
    }

    companion object {
        var instance: YApplication by DelegatesExt.notNullSingleValue()

    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        init_autosize_confic()
    }

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        MultiDex.install(base)
    }

    fun  init_autosize_confic(){
        AutoSizeConfig.getInstance().getUnitsManager()
            .setSupportDP(false)
            .setSupportSP(false)
            .setSupportSubunits(Subunits.PT)
    }

}